import {
  createRouter,
  createWebHashHistory
} from 'vue-router'
import LayoutView from '../views/LayoutView.vue'

const router = createRouter({
  history: createWebHashHistory(
    import.meta.env.BASE_URL),
  routes: [{
      path: '/',
      redirect: '/login' 
    },
    {
      path: '/',
      name: 'home',
      component: LayoutView,
      children: [
        {
          path: 'behavior',
          meta: {
            title: '行为管理'
          },
          component: () => import('../views/BehaviorView.vue'),
        },
        {
          path: 'leave',
          meta: {
            title: '请假管理'
          },
          component: () => import('../views/LeaveView.vue'),
        },
        {
          path: 'my',
          component: () => import('../views/MyView.vue'),
        }
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/LoginView.vue')
    },
    {
      path: '/behavior/add',
      name: 'behavioradd',
      component: () => import('../views/AddBehaviorView.vue')
    },
    {
      path: '/leave/add',
      name: 'leaveadd',
      component: () => import('../views/AddLeaveView.vue')
    }
  ]
})

export default router